package cn.zcx;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

import javax.management.relation.RelationSupport;
import java.sql.*;

/**
 * description:
 * author:zcx
 * lenovo
 * 时间：2022.03.01.14.18
 */
public class MyDemo {
    @Test @DisplayName("mysql5.6.51")
    public void m5(){
        String driver="com.mysql.jdbc.Driver";
        String url="jdbc:mysql://192.168.21.68:49153";
        String user="root";
        String pwd="root";
        try {
            Class.forName(driver);
            Connection conn= DriverManager.getConnection(url,user,pwd);
            System.out.println(conn);
            Statement st=conn.createStatement();
            ResultSet rs=st.executeQuery("select now()");
            st.executeUpdate("create database db2");
            //int row=st.executeUpdate("drop database mysql");
            //System.out.println(row);
            while(rs.next()){
                System.out.println(rs.getDate(1));
                System.out.println(rs.getTimestamp(1));
            }
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
        }

    }
}
